package com.blockmeta.bbs.immodule.net.pojo;

import android.text.TextUtils;

import com.blockmeta.bbs.immodule.bean.beaninterface.ICircleEntry;
import com.blockmeta.bbs.immodule.utils.IMUtils;
import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * @author AirThor
 * @date 2020/3/9.
 */
public class SearchCirclesResponse {

    /**
     * list : [{"auth_rule":0,"big_class_id":1,"big_class_name":"综合","chat_group_name":"吹水圈子2233","create_time":1581071090,"create_user_id":365688,"create_user_name":"马路边一分钱","id":29,"identification":0,"me_in":1,"msg_total_count":0,"user_count":14,"user_level":0,"yesterday_msg_count":0}]
     * page_num : 1
     * page_size : 20
     * total_count : 1
     */

    @SerializedName("page_num")
    public int pageNum;
    @SerializedName("page_size")
    public int pageSize;
    @SerializedName("total_count")
    public int totalCount;
    @SerializedName("list")
    public List<ListBean> list;

    public static class ListBean implements ICircleEntry {
        /**
         * auth_rule : 0
         * big_class_id : 1
         * big_class_name : 综合
         * group_logo
         * chat_group_name : 吹水圈子2233
         * create_time : 1581071090
         * create_user_id : 365688
         * create_user_name : 马路边一分钱
         * id : 29
         * identification : 0
         * me_in : 1
         * msg_total_count : 0
         * user_count : 14
         * user_level : 0
         * yesterday_msg_count : 0
         */

        @SerializedName("auth_rule")
        public int authRule;
        @SerializedName("big_class_id")
        public int bigClassId;
        @SerializedName("big_class_name")
        public String bigClassName;
        @SerializedName("group_logo")
        public String groupLogo;
        @SerializedName("chat_group_name")
        public String chatGroupName;
        @SerializedName("create_time")
        public int createTime;
        @SerializedName("create_user_id")
        public int createUserId;
        @SerializedName("create_user_name")
        public String createUserName;
        @SerializedName("id")
        public int id;
        @SerializedName("identification")
        public int identification;
        @SerializedName("me_in")
        public boolean joinState;
        @SerializedName("msg_total_count")
        public int msgTotalCount;
        @SerializedName("user_count")
        public int userCount;
        @SerializedName("user_level")
        public int userLevel;
        @SerializedName("yesterday_msg_count")
        public int yesterdayMsgCount;

        @Override
        public long getId() {
            return id;
        }

        @Override
        public boolean recommendCircle() {
            return false;
        }

        @Override
        public String getCircleLogo() {
            return TextUtils.isEmpty(groupLogo)? "aaa":groupLogo;
        }

        @Override
        public String getCircleName() {
            return chatGroupName;
        }

        @Override
        public String getCircleSign() {
            return IMUtils.getCircleClass(bigClassId);
        }

        @Override
        public String getCircleSize() {
            return String.valueOf(userCount);
        }

        @Override
        public String getCircleGrade() {
            return "0";
        }

        @Override
        public String getCircleKind() {
            return "群组";
        }

        @Override
        public String getCircleJoinLimit() {
            return "等级要求："+IMUtils.getLimitGrade(userLevel);
        }

        @Override
        public boolean getJoinState() {
            return joinState;
        }

        @Override
        public int getCircleAuthRule() {
            return authRule;
        }

        @Override
        public boolean isIdentification() {
            return identification==1;
        }

        @Override
        public long getCreateById() {
            return createUserId;
        }

        @Override
        public void setJoinState(boolean joinState) {

        }

        @Override
        public int getUserLevel() {
            return userLevel;
        }
    }
}
